home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 151-175 / scopedisk168 / asmmacros / am_02 / read.i < prev    next >
Text File  |  1995-03-19  |  2KB  |  95 lines

  1.      NOLIST
  2. Read        MACRO              ; 25 Dec 88
  3. *------------------------------; Start of Read macro.
  4.                                ; Put the file handle in D1.
  5.      NOLIST
  6.      IFEQ ReEntrant-1
  7.      LIST
  8.      MOVE.L \1(A5),D1
  9.      NOLIST
  10.      ENDC
  11.      IFNE ReEntrant-1
  12.      LIST
  13.      MOVE.L \1,D1
  14.      NOLIST
  15.      ENDC
  16.      LIST
  17.                                ; Make D2 point to the start of the buffer.
  18.      NOLIST
  19.      IFC '\2','D'
  20.      LIST
  21.      MOVE.L #\3,D2
  22.      NOLIST
  23.      IFEQ ReEntrant-1
  24.      LIST
  25.      ADD.L A5,D2
  26.      NOLIST
  27.      ENDC
  28.      ENDC
  29.      IFC '\2','I'
  30.      IFEQ ReEntrant-1
  31.      LIST
  32.      MOVE.L \3.Adr(A5),D2
  33.      NOLIST
  34.      ENDC
  35.      IFNE ReEntrant-1
  36.      LIST
  37.      MOVE.L \3.Adr,D2
  38.      NOLIST
  39.      ENDC
  40.      ENDC
  41.      IFEQ NARG-3               ; If there is no fourth argument, and
  42.      IFC '\2','D'              ;  <BufferStartAddr> is specified, then
  43.      LIST
  44.                                ; Calculate the buffer size as
  45.                                ;  <BufferStartAddr>End minus
  46.                                ;  <BufferStartAddr>. Put it in D3.
  47.      MOVE.L #\3End-\3,D3
  48.      NOLIST
  49.      ENDC
  50.      IFC '\2','I'              ; If <MemBlockName> is specified, then
  51.      LIST
  52.                                ; Get the buffer size from <MemBlockName>.Size
  53.      NOLIST
  54.      IFEQ ReEntrant-1
  55.      LIST
  56.      MOVE.L \3.Size(A5),D3
  57.      NOLIST
  58.      ENDC
  59.      IFNE ReEntrant-1
  60.      LIST
  61.      MOVE.L \3.Size,D3
  62.      NOLIST
  63.      ENDC
  64.      ENDC
  65.      ENDC
  66.      IFEQ NARG-4               ; If the fourth argument exists,
  67.      IFNC '\4','D3'            ;  and it is not "D3", then
  68.      LIST
  69.                                ; Use the buffer size of the fourth argument.
  70.      MOVE.L #\4,D3
  71.      NOLIST
  72.      ENDC
  73.      ENDC
  74.      LIST
  75.      CallLib Read,dos          ; Call Read.
  76.                                ; Store the actual length read at \3.Len .
  77.      NOLIST
  78.      IFEQ ReEntrant-1
  79.      LIST
  80.      DefDS \3.Len,1
  81.      MOVE.L D0,\3.Len(A5)
  82.      NOLIST
  83.      ENDC
  84.      IFNE ReEntrant-1
  85.      LIST
  86.      DS_BSS \3.Len,1,.L
  87.      MOVE.L D0,\3.Len
  88.      NOLIST
  89.      ENDC
  90.      LIST
  91.      CMPI.L #-1,D0             ; Make the zero flag indicate failure.
  92. *------------------------------; End of Read macro.
  93.      ENDM
  94.      LIST
  95.